import { Router } from "express";
import { CapCallbackFn } from "../../type";

export default (router: Router, callbackFn: CapCallbackFn) => {
  router.post("/getavatar", (req, res) => {
     let {username} = req.body
     let sql = `select avatar from UserInfo where username = '${username}'`
     callbackFn(res,{sql})
  });

  router.post("/setavatar",(req,res)=>{
    let {username,base64} = req.body
    // console.log(username)
    // console.log(base64)
    let sql = `update UserInfo set avatar = '${base64}' where username = '${username}'`
    callbackFn(res,{sql})
  })

  return router;

};
